#include "Wiimote.h"

using namespace MediaCenter;

Wiimote::Wiimote(wiimote* wiimote) :
	wm(wiimote),
	Connected(false)
{

}

Wiimote::~Wiimote()
{

}

void Wiimote::SetRumble(int rumbleValue)
{
	wiiuse_rumble(wm, rumbleValue);
}

void Wiimote::SetLEDs(int ledCodes)
{
	wiiuse_set_leds(wm, ledCodes);
}

bool Wiimote::ButtonDown(int buttonCode)
{
	return ( wm->btns & buttonCode ) == buttonCode;
}

bool Wiimote::ButtonUp(int buttonCode)
{
	return !(( wm->btns & buttonCode ) == buttonCode);
}

bool Wiimote::ButtonPress(int buttonCode)
{
	return (ButtonDown(buttonCode) && !((wm->btns_held & buttonCode) == buttonCode));
}

bool Wiimote::ButtonRelease(int buttonCode)
{
	return ((wm->btns_released & buttonCode) == buttonCode);
}